package com.yixing.configuration.controller;

import com.yixing.configuration.model.Dbtypes;
import com.yixing.configuration.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/yml")
@RestController
public class YmlController {
    @Value("${string.value2}")
    private String value2;
    @Value("${string.str1}")
    private String str1;
    @Value("${string.str2}")
    private String str2;
    @Value("${string.str3}")
    private String str3;
    @Autowired
    private Student student;
    @Autowired
    private Dbtypes dbtypes;

    @RequestMapping("/readValue1")
    public String readValue1() {
        return "从yml中读取配置文件，value2:" + value2 + ", str1:" + str1
                + ", str2:" + str2 + ", str3:" + str3;
    }

    @RequestMapping("/readValue2")
    public String readValue2() {
         return student.toString();
    }

    @RequestMapping("/readValue3")
    public String readValue3() {
      return dbtypes.toString();
    }
}
